next up previous
Next: 4.3 Window Manager Interactions Up: 4 Usage Considerations Previous: 4.1 Shallower Depths

4.2 Overlay Colormaps

Colormaps create another area of concern. Normally if you create windows using the default visual, you use the default colormap and allocate colors from it. Since most windows use the default colormap, occasions when the colormap is not installed are rare. Since overlays can not typically use the default colormap and each client ends up needing to create a unique colormap to use with its overlay windows, colormap flashing problems are easy to create in the overlay planes. And generally overlay planes do not support multiple simultaneous colormaps.

However it is generally true that the overlay planes often have a distinct hardware colormap from the normal planes meaning a colormap for the overlay planes and a colormap for the normal planes can usually be installed simultaneously. This is the case on SGI graphics hardware.

If you are new to the practice of using non-default colormaps, you should note that BlackPixel and WhitePixel return pixel values for the default colormap. Colormaps created with XCreateColormap are not created with preallocated black and white pixels. If you need black and white pixels, you should allocate them yourself.

Also remember to use XSetWMColormapWindows if you have a window using a colormap not the same as the colormap of your toplevel window. This allows a window manager to install the appropriate colormaps for your client.

There exists one more caveat to using overlay colormaps. Because the transparent pixel is preallocated as pixel zero in SGI X servers, it is impossible to allocate all the colormap cells. SGI has opted to generate a BadAlloc error if a colormap for an overlay visual is created with the AllocAll parameter. Client programs should instead use AllocNone when creating overlay colormaps and allocate colormap cells individually.

Hewlett-Packard's implementation puts the default visual in the overlay planes making it possible to use the default colormap.



next up previous
Next: 4.3 Window Manager Interactions Up: 4 Usage Considerations Previous: 4.1 Shallower Depths



Mark Kilgard
Sun Jan 7 19:28:30 PST 1996